package com.atguigu.yygh.order.controller;

import com.atguigu.yygh.hosp.result.R;
import com.atguigu.yygh.order.service.WeixinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/order/weixin")
public class WeixinApiController {
    @Autowired
    WeixinService weixinService;

    /**
     * 为指定的订单生成一个支付链接
     */
    @GetMapping("/createNative/{orderId}")
    public R createNative(@PathVariable Long orderId){
       String codeUrl = weixinService.createNative(orderId);
       return R.ok().data("codeUrl",codeUrl);
    }
}
